package com.example.myapplication.lol.ui;

import android.os.Bundle;
import android.view.View;

import androidx.viewpager.widget.ViewPager;

import com.example.myapplication.R;
import com.example.myapplication.lol.adapter.VpRecordFragmentAdapter;
import com.example.myapplication.lol.base.BaseFragment;
import com.example.myapplication.lol.bean.TabBean;
import com.google.android.material.tabs.TabLayout;

public class FragmentLol5 extends BaseFragment {
    private TabLayout mTabLayout;
    private ViewPager mViewPager;
    private VpRecordFragmentAdapter mVpRecordFragmentAdapter;
    public static Bundle newArgument(String title) {
        Bundle args = new Bundle();
        args.putString("title", title);
        return args;
    }

    @Override
    protected int rootLayout() {
        return R.layout.fragment_lol_5;
    }

    @Override
    protected void initView(View view) {
        mTabLayout = view.findViewById(R.id.my_tab);
        mViewPager = view.findViewById(R.id.my_viewpager);
    }

    @Override
    protected void initData() {
        mVpRecordFragmentAdapter = new VpRecordFragmentAdapter(getChildFragmentManager());
        mViewPager.setAdapter(mVpRecordFragmentAdapter);
        mTabLayout.setupWithViewPager(mViewPager);
        mTabLayout.setInlineLabel(true);
    }

    @Override
    protected void bindData() {
        super.bindData();
        mVpRecordFragmentAdapter.addData(new TabBean(TabBean.TYPE_ARTICLE,"战绩"));
        mVpRecordFragmentAdapter.addData(new TabBean(TabBean.TYPE_ARTICLE,"帖子"));
    }

    @Override
    protected void bindEvent() {
    }
}